import java.awt.Dimension;
import java.awt.Toolkit;
import java.io.IOException;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class ButtonDefaultShell {
	
	
	
  public static void main(String[] args) {
	  
	int shellWidth = 200;
	int shellHeight = 200;
	
	  
    Display display = new Display();
    final Shell shell = new Shell(display);
    
    shell.setLayout(new FormLayout());

    FormData formData = new FormData();
    formData.width = 100;
    formData.height = 30;
    

    Button button1 = new Button(shell, SWT.PUSH);
    button1.setText("info");
    button1.setLayoutData(formData);
    SelectionListener sl = new SelectionAdapter() {
		public void widgetSelected(SelectionEvent event) {
			label2.setText("test");
		}
	};
    
    button1.addSelectionListener(sl);
        
    
    Dimension d = Toolkit.getDefaultToolkit().  getScreenSize()  ;
    shell.setLocation((int) ((d.getWidth()-shellWidth)/2), (int) ((d.getHeight()-shellHeight)/2));

    shell.setSize(shellWidth, shellHeight);
    shell.open();

    while (!shell.isDisposed()) {
      if (!display.readAndDispatch()) {
        display.sleep();
      }
    }
    display.dispose();
  }
}